/*package _Banque._TUN;

import _Banque.Banque;
import _Banque.CompteBancaire;
import _Banque.Titulaire;
import _Exception.BUException;
import _Exception.IPException;
import _Tests.Tests;*/

//IUT de Nice / Departement informatique / Module APO Java
//Annee 2011_2012 - TP_Banque
//
//Classe CompteBancaire - Tests unitaires de la methode executer.
//           (cas nominaux)
//
//Auteur : J.COLIN & N.NAGY
//
public class T_CompteBancaire_N3_1 {


     public static void main (String[] args) throws IPException, BUException{

                Tests.Begin("_Banque.CompteBancaire", "1..0");

                Banque banque = new Banque("S2D","12345", "IUT Info", "01234567891011");
                String adresse_1= "Imm. Les Magnolias Bat. 2, 8 Bd Napoleon III - NICE (06000)";
                String adresse_2= "Villa Beau Sejour, 115 Av. de la Grande Armee - PARIS (75000)";

                Titulaire dupuy = new Titulaire("DUPUY", "melanie", "1978/04/25", adresse_1);
                Titulaire durand = new Titulaire("Durand", "Paul", "1981/01/03",  adresse_2);

                //String titulaire_1= "DUPUY Melanie (1978/04/25) - Imm. Les Magnolias Bat. 2, 8 Bd Napoleon III - NICE (06000)";
                //String titulaire_2= "DURAND Paul (1981/01/03) - Villa Beau Sejour, 115 Av. de la Grande Armee - PARIS (75000)";

                CompteBancaire cpt_1 = new CompteBancaire(banque, dupuy);
                CompteBancaire cpt_2 = new CompteBancaire(banque, durand);

                Tests.Design("Controle du service executer", 3); {

                        Tests.Case("Cas d'un seul compte"); {

                                CompteBancaire cpt = new CompteBancaire(banque, dupuy);

                                cpt.executer("Guichet 322455", 'V', 200);

                                Tests.Unit(200.0f, cpt.getSoldeCompte());
                                Tests.Unit(1, cpt.getNombreOperations());

                                cpt.executer("Guichet 322455", 'V', (float) 320.5);

                                Tests.Unit(520.5f,  cpt.getSoldeCompte());
                        Tests.Unit(2,       cpt.getNombreOperations());

                        cpt.executer("Facture 2009-29", 'R', (float)400);

                        Tests.Unit(120.5f,  cpt.getSoldeCompte());
                        Tests.Unit(3,       cpt.getNombreOperations());

                        cpt.executer("Guichet 322455", 'V', (float)100);

                        Tests.Unit(220.5f,  cpt.getSoldeCompte());
                        Tests.Unit(4,       cpt.getNombreOperations());
                      }

                        Tests.Case("Cas de plusieurs comptes"); {

                                cpt_1.executer("Guichet 322455", 'V', 200);
                        cpt_1.executer("Guichet 322455", 'V', 320.5f);
                        cpt_1.executer("Facture 2009-29", 'R', 400);
                        cpt_1.executer("Guichet 322455", 'V',  100);

                        Tests.Unit(220.5f,  cpt_1.getSoldeCompte());
                        Tests.Unit(4,       cpt_1.getNombreOperations());

                        cpt_2.executer("Guichet 760999", 'V', 350);

                        Tests.Unit(350.f,  cpt_2.getSoldeCompte());
                        Tests.Unit(1,      cpt_2.getNombreOperations());

                        cpt_2.executer("Facture 2009-04", 'R', 300);

                        Tests.Unit(50.f,  cpt_2.getSoldeCompte());
                        Tests.Unit(2,     cpt_2.getNombreOperations());
                        }

                        Tests.Case("Cas de l'augmentation de la taile de l'historique"); {
                                 CompteBancaire cpt = new CompteBancaire(banque, dupuy);

                                 // Premiere serie de 10 operations
                                 //
                                 cpt.executer("Guichet 322455", 'V', 200);
                         cpt.executer("Guichet 322455", 'V', 320.5f);
                         cpt.executer("Facture 2009-29", 'R', 400);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Facture 2009-30", 'R', 20.5f);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Facture 2009-31", 'R', 100);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Facture 2009-32", 'R',100);
                         cpt.executer("Guichet 322455", 'V', 100);

                         Tests.Unit(300.f,  cpt.getSoldeCompte());
                         Tests.Unit(10,     cpt.getNombreOperations());

                         // Deuxieme serie d'operations
                         //
                        cpt.executer("Facture 2009-33", 'R',100);

                         Tests.Unit(200.f,  cpt.getSoldeCompte());
                         Tests.Unit(11,     cpt.getNombreOperations());

                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Guichet 322455", 'V', 100);
                         cpt.executer("Guichet 322455", 'V', 100);

                         Tests.Unit(1200.f,  cpt.getSoldeCompte());
                         Tests.Unit(21,      cpt.getNombreOperations());
                        }
                        }
                Tests.End();
                }

}
